#include "ResourcePool.h"

/* Global resource manager */
ResourcePool Resource;

extern "C" {
#define IMPORT_FONT(name)        \
do{                              \
    LV_FONT_DECLARE(font_##name) \
    Resource.Font_.AddResource(#name, (void*)&font_##name);\
}while(0)

#define IMPORT_IMG_USER(name)    \
do{                              \
    LV_IMG_DECLARE(img_##name)   \
    Resource.Image_.AddResource(#name, (void*)&img_##name);\
}while (0)

    static void Resource_Init()
    {
        /* Import Fonts */
        IMPORT_FONT(num_56);
        IMPORT_FONT(tem);
        IMPORT_FONT(en_18);
        IMPORT_FONT(city_cn_10);
        IMPORT_FONT(time_10);
        /* Import Images */
        IMPORT_IMG_USER(Sun);  // 晴
        IMPORT_IMG_USER(Cloud);  // 阴
        IMPORT_IMG_USER(Cloud_angled_rain_zap);  // 雨
        IMPORT_IMG_USER(Big_snow);// 雪
        IMPORT_IMG_USER(Slow_winds);  // 霾
        IMPORT_IMG_USER(distantion);  // 位置
    }

} /* extern "C" */

void ResourcePool::Init()
{
    Font_.SetDefault((void*)&lv_font_montserrat_14);

    Resource_Init();
}
